package com.tg.paw.common.feign.fallback;

import com.tg.paw.common.constant.CommonConstant;
import com.tg.paw.common.entity.UserAdmin;
import com.tg.paw.common.feign.AdminServiceFeignClient;
import com.tg.paw.common.util.CommonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author Rubble
 * @date 2020/10/28
 */
@Component
public class AdminServiceFeignFallbackFactory implements FallbackFactory<AdminServiceFeignClient> {
    @Override
    public AdminServiceFeignClient create(Throwable throwable) {
        return new AdminServiceFeignClient() {
            @Override
            public CommonResult<UserAdmin> currentUser() {
                return CommonResult.hystrixFailed(AdminServiceFeignClient.class);
            }
        };
    }
}
